﻿@{
    string[] folders = Directory.GetDirectories(Checklist.GetSiteSectionFolder(Request)).Where(f => !f.EndsWith("DemoList")).ToArray();
}

<nav role="navigation">
    <span>Menu</span>

    <ul>
        <li><a href="/">Home</a>

            @foreach (string dir in folders)
            {
                var dirName = Path.GetFileName(dir);
                var files = Directory.GetFiles(dir, "*.xml").Where(f => !f.EndsWith("index.xml"));
                
                <ul>
                    <li><a href="/@dirName.ToLowerInvariant()/">@dirName.Replace("-", " ")</a>

                        @if (files.Count() > 0)
                        {
                            <ul>
                                @foreach (string file in files)
                                {
                                    var fileName = Path.GetFileNameWithoutExtension(file);
                                    var url = file.Replace(dir, string.Empty).Replace(".xml", string.Empty).Replace("\\", "/").TrimStart('/').ToLowerInvariant();
                                    <li><a href="/@dirName.ToLowerInvariant()/@url/">@fileName</a></li>
                                }
                            </ul>
                        }
                    </li>
                </ul>
            }

        </li>
        <li class="planned"><br />NodeJS (planned)</li>
        <li class="planned">PHP (planned)</li>
        <li class="planned">Python (planned)</li>
        <li class="planned">Rails (planned)</li>
        <li class="planned"><br />Usability (planned)</li>
        <li class="planned">Accessibility (planned)</li>
        <li class="planned">Performance (planned)</li>
        <li class="planned"><a href="https://github.com/ligershark/webdevchecklist.com/wiki/sections/">Help needed</a></li>
    </ul>
</nav>